package titt.head.request;

import titt.head.request.RequestHead;
import titt.head.util.AbstractRequest;

public class BrowserRequestHead extends AbstractRequest {

	public static final String 	MOZILLA_BROWSER = "Mozilla",
								LINUX_OS = "Linux";

	public BrowserRequestHead(RequestHead req) {
		super.h = req;
	}
	
	public String getBrowser() {
		String ua = getHeader("User-Agent").getValue();
		
		if(ua == null) return null;
				
		if(ua.startsWith("Mozilla")) return MOZILLA_BROWSER;
		
		return ua.split(" ")[0];
	}
	
	public String getOperatingSystem() {
		String ua = getHeader("User-Agent").getValue();
		
		if(ua == null) return null;

		if(ua.indexOf("Linux") != -1) return LINUX_OS;
		
		return null;
	}
	
}
